package com.bw.lib_base.net

import com.bw.lib_base.entity.*
import com.bw.repair.RepairBean
import com.bw.repair.RepairBeanItem
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query

interface ApiService {
    @POST("/api/user/register")
    suspend fun register(@Query("password")password: String, @Query("username")username:String): Res<UserBean>

    @POST("/api/user/login")
    suspend fun login(@Query("password")password: String, @Query("username")username:String): Res<UserBean>

    //公告
    @GET("/api/announcements")
    suspend fun getNotices(@Query("page")page: Int, @Query("size")size: Int):Res<NoticeBean>

    //车位
    @GET("/api/parking-spaces/type/{spaceType}")
    suspend fun getParkByType(@Path("spaceType")spaceType: String): Res<ParkBean>

    @GET("/api/parking-spaces/status/{spaceStatus}")
    suspend fun getParkByStatus(@Path("spaceStatus")spaceStatus:String):Res<ParkBean>

    @GET("/api/parking-spaces/area/{areaId}")
    suspend fun getParkByArea(@Path("areaId")areaId:Int): Res<ParkBean>

    @GET("/api/parking-spaces/license/{licensePlate}")
    suspend fun getParkByCarNumber(@Path("licensePlate")licensePlate:String): Res<ParkBeanItem>

    @POST("/api/parking-spaces")
    suspend fun addPark(@Body body:RequestBody): Res<ParkBeanItem>

    @GET("/api/parking-spaces/{id}")
    suspend fun detailPark(@Path("id")id: Int):Res<ParkBeanItem>

    @PUT("/api/parking-spaces/{id}")
    suspend fun update(@Path("id")id: Int, @Body body: ParkBeanItem) :Res<ParkBeanItem>

    @DELETE("/api/parking-spaces/{id}")
    suspend fun deletePark(@Path("id")id: Int) :Res<Boolean>

    @GET("/api/repair-orders")
    suspend fun repair(): Res<RepairBean>

    @GET("/api/repair-orders/order-number/{orderNumber}")
    suspend fun getRepairByNum(@Path("orderNumber")orderNumber: String): Res<RepairBeanItem>

    @GET("/api/repair-orders/search")
    suspend fun getRepairByName(@Query("repairName")repairName: String): Res<RepairBean>

    @GET("/api/repair-orders/{id}")
    suspend fun getDetail(@Path("id")id: Int): Res<RepairBeanItem>

    @PUT("/api/repair-orders/{id}")
    suspend fun updateRepair(@Path("id")id: Int,@Body body: RepairBeanItem) :Res<RepairBeanItem>

    @POST("/api/repair-orders")
    suspend fun addRepair(@Body body:RepairBeanItem) :Res<RepairBeanItem>

    @GET("/api/visit-appointments")
    suspend fun getVisit(): Res<VisitBean>

    @DELETE("/api/repair-orders/{id}")
    suspend fun deleteRepair(@Path("id")id: Int): Res<Boolean>

    @GET("/api/visit-appointments/status/{status}")
    suspend fun getVisitByStatus(@Path("status")status: String): Res<VisitBean>

    @GET("/api/visit-appointments/search/name")
    suspend fun getVisitByName(@Query("name")name: String): Res<VisitBean>

    @GET("/api/visit-appointments/{id}")
    suspend fun getVisitById(@Path("id")id: Int): Res<VisitBeanItem>

    @POST("/api/attendances")
    suspend fun sign(@Body body: RequestBody):Res<SignBeanItem>

    @GET("/api/attendances/user/{userId}")
    suspend fun signHistory(@Path("userId")userId:Int):Res<SignBean>
}